<?php
/**
 * 数据库连接类
 * 
 * Enter description here ...
 * @author Administrator
 *
 */

class DbCon{
	
	private $dsn = array(
				'phptype'  => "mysql",
                'username' => "586990_boostidea",
                'password' => "IObit20110829",
                'host' => "mysql50-103.wc2.dfw1.stabletransit.com",
                'port'     => "3306",
                'database' => "586990_jetboost_imidea_com",
	);
	
	private static $connect;	
	
	private static $db;
	
	private function  __clone(){}
	
	private function __construct()
	{			
		self::$connect = mysql_connect($this->dsn['host'],$this->dsn['username'],$this->dsn['password']);
		if (!self::$connect) 
		{
   			 die('Could not connect: ' . mysql_error());
		}
		
		mysql_select_db($this->dsn['database'], self::$connect);
		
	}
	
	public static function getInstance()
	{
		if(isset(self::$db))
		{
			return self::$db;
		}
		else
		{
			self::$db = new DbCon();
			return self::$db;
		}		
	}
	
	public function getCon()
	{
		return self::$connect;
	}

	public function closeDB()
	{
		mysql_close(self::$connect);
	}
	
	 
}